using Newtonsoft.Json;
using QFramework;

namespace TodoPro.Utility
{
    public interface IJsonSerializer : IUtility
    {
        string Serialize(object obj);

        T Deserialize<T>(string jsonString);
    }

    public class DefaultJsonSerializer : IJsonSerializer
    {
        public string Serialize(object obj)
        {
            return JsonConvert.SerializeObject(obj);
        }

        public T Deserialize<T>(string jsonString)
        {
            return JsonConvert.DeserializeObject<T>(jsonString);
        }
    }
}